import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace BaseinfoIndicatorApi {
  /** 需求指标信息 */
  export interface BaseinfoIndicator {
    id: number; // 序号
    ruleName: string; // 规则名称
    ruleDescription: string; // 规则描述
    targetNo: number; // 指标编码
    targetName: string; // 指标名称
    targetDescription: string; // 指标描述
    status: string; // 状态
    flag: boolean; // 1新增2更新3删除
  }
}

/** 查询需求指标分页 */
export function getBaseinfoIndicatorPage(params: PageParam) {
  return requestClient.get<PageResult<BaseinfoIndicatorApi.BaseinfoIndicator>>('/csyt/baseinfo-indicator/page', { params });
}

/** 查询需求指标详情 */
export function getBaseinfoIndicator(id: number) {
  return requestClient.get<BaseinfoIndicatorApi.BaseinfoIndicator>(`/csyt/baseinfo-indicator/get?id=${id}`);
}

/** 新增需求指标 */
export function createBaseinfoIndicator(data: BaseinfoIndicatorApi.BaseinfoIndicator) {
  return requestClient.post('/csyt/baseinfo-indicator/create', data);
}

/** 修改需求指标 */
export function updateBaseinfoIndicator(data: BaseinfoIndicatorApi.BaseinfoIndicator) {
  return requestClient.put('/csyt/baseinfo-indicator/update', data);
}

/** 删除需求指标 */
export function deleteBaseinfoIndicator(id: number) {
  return requestClient.delete(`/csyt/baseinfo-indicator/delete?id=${id}`);
}

/** 批量删除需求指标 */
export function deleteBaseinfoIndicatorList(ids: number[]) {
  return requestClient.delete(`/csyt/baseinfo-indicator/delete-list?ids=${ids.join(',')}`)
}

/** 导出需求指标 */
export function exportBaseinfoIndicator(params: any) {
  return requestClient.download('/csyt/baseinfo-indicator/export-excel', params);
}

